﻿/*************************************************************************
 * Created by OhZee Creative, LLC
 * 2013
 * This code is licensed under Microsoft Public License (Ms-PL)
 * http://opensource.org/licenses/ms-pl
 * http://ozframework.codeplex.com/
 *************************************************************************/

namespace OhZeeCreative.Windows8
{
    using System;
    using System.Threading.Tasks;
    using Windows.System;
    using Windows.System.Display;

    public static class Utils
    {
        public static async Task GoToUri(Uri uri)
        {
            await Launcher.LaunchUriAsync(uri);
        }

        public static async Task MailTo(string emailAddress)
        {
            await GoToUri(new Uri("mailto://" + emailAddress));
        }

        // 1. In Application.OnLaunched() add the following code:
        //    SettingsPane.GetForCurrentView().CommandsRequested += this.App_CommandsRequested;
        //
        // 2. Add the following method:
        //    private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        //    {
        //        args.Request.ApplicationCommands.Add(new SettingsCommand("Privacy", "Privacy", _ => Utils.GoToGenericPrivacyLink()));
        //    }

        public static async void GoToGenericPrivacyLink()
        {
            await GoToUri(new Uri("http://www.ohzeecreative.com/vault/generic privacy policy.html", UriKind.Absolute));
        }

        public static bool TryUnsnap()
        {
            return Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
        }
    }
}
